<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../assets/css/layui.css" />
		<script src="../assets/layui.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../js/bootstarp-3.3.7/css/bootstrap.min.css" />
		<script src="../js/jquery/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../js/bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="../js/bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

	</head>
	<script>
		$(function() { //, headers: { 'x-requested-with': 'XMLHttpRequest' }
			$.ajaxSetup({
				crossDomain: true,
				xhrFields: {
					withCredentials: true
				}
			});
		});
	</script>

	<script type="text/javascript">
		layui.use('element', function() {
			var $ = layui.jquery,
				element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		})

		$(function() {

			$("#btn2").click(function() {
				$("#hzk").bootstrapTable('refresh')

			})

			$("#hzk").bootstrapTable({
				url: "http://127.0.0.1:8099/nw/selectPatient",
				pagination: true,
				pageSize: 5,
				queryParams: queryParams2,
				columns: [{
					field: 'name',
					title: '患者姓名',
					align: 'center',
				}, {
					field: 'sex',
					title: '性别',
					align: 'center',
				}, {
					field: 'age',
					title: '年龄(周岁)',
					align: 'center',
				}, {
					field: 'mobile',
					title: '电话',
					align: 'center',
				}, {
					field: 'updateTime',
					title: '更新时间',
					align: 'center',
				}, {
					title: '操作',
					align: 'center',
					formatter: function(value, row, index) {
						return '<button onclick="chooseHz(' + row.patientId + ')" class="btn btn-info glyphicon glyphicon-ok-circle"></button>'
					}
				}]
			})
		})

		function chooseHz(id) {
			parent.$("#patientId").val(id)
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);

		}

		function queryParams2(Params) {

			return {
				'name': $("#patientname").val()

			}
		}
	</script>

	<body>
		<br />

		<div class="layui-form-item" align="center">
			<form class="form-inline">
				<label for="exampleInputName2">患者姓名：</label>
				<input type="text" class="form-control" name="" id="patientname" value="" placeholder="请输入姓名" />
				<button type="button" class="btn btn-primary glyphicon glyphicon-search" id="btn2"></button>

			</form>
			<br />
			<div>
				<table id="hzk"></table>
			</div>

		</div>

	</body>

</html>